package conf;

import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.List;

public class XmlConfigDo extends XmlDo implements ConfigDo {

    public XmlConfigDo(String file,String charset) throws IOException {
        super(file,charset);
    }
    public XmlConfigDo(String xml){
        super(xml);
    }

    @Override
    public <T> List<T> getNodeList(String name)
    {
        Elements objects=getElementsByTag(name);
        return  ( List<T>)objects.subList(0,objects.size());
    }
  /*  public List<Element> getNodeList(String name)
    {
        Elements objects=getElementsByTag(name);
        return  objects.subList(0,objects.size());
    }*/
    @Override
    public Element getNode1(String name)
    {
        return getElementsByTag(name).first();
    }
    @Override
    public <T> String getNodeAttr(T t, String key) {
        return ((Element)t).attr(key);
    }
    @Override
    public <T> String getNodeText(T t) {
        return ((Element)t).text();
    }


}
